const { spawn } = require('child_process');
const child = spawn('wc');

// child.on('exit',(code, signal)=>{
//   console.log('child process exited with' + `code ${code} and signal ${signal}`);
// });
// child.on('close',(code,signal)=>{
//   console.log('child process closed with' + `code ${code} and signal ${signal}`);
// });
// child.stdout.on("data",(data)=>{
//     console.log(`stdout:${data}`);
// })
// child.stderr.on("data",(data)=>{
//     console.log(`stderr:${data}`);
// });

process.stdin.pipe(child.stdin)

child.stdout.on('data',(data)=>{
    console.log(`child stdout:\n ${data}`);
})